package com.example.ytyproject.controller;


import com.example.ytyproject.entity.BillFare;
import com.example.ytyproject.entity.vo.BillCategoryVo;
import com.example.ytyproject.entity.vo.R;
import com.example.ytyproject.service.BillFareService;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 菜单基本表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-04-16
 */
@RestController
@RequestMapping("/billFare")
@Slf4j
public class BillFareController {

    @Autowired
    private BillFareService billFareService;

    @PostMapping("/listByPage")
    public R listByPage(@RequestBody BillFare param) {
        return billFareService.listByPage(param);
    }

    @PostMapping("/addData")
    public R addData(@RequestBody BillFare param) {
        billFareService.addData(param);
        return R.ok();
    }

    @PostMapping("/updateData")
    public R updateData(@RequestBody BillFare param) {
        billFareService.updateData(param);
        return R.ok();
    }
    @DeleteMapping("/deleteBillData")
    public R deleteBillData(@Param("id") String id) {
        billFareService.removeById(id);
        return R.ok();
    }
    @PostMapping("/billCategory")
    @ApiModelProperty("菜品分类")
    public R billTree() {
        return R.ok(billFareService.billCategory());
    }

}
